package com.choupin.choupin.entity;

import cn.hutool.core.date.DateTime;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;

public class Order extends BaseEntity {
    private Integer id;//订单表id
    private  String phone; //手机号
    private Integer typeId;// 外键，抽奖池表id或会员表id
    private Integer type;// 0 为购买抽奖券  1为购买会员
    private String image;// 图片
    private String name;// 名称
    private BigDecimal price;// 价格
    private LocalDateTime startTime;// 下单时间
    private LocalDateTime endTime;// 结束时间
    private Integer status;// 0待付款  1交易成功  2交易失败 3交易失效

    public Order() {
    }

    public Order(Integer id, String phone, Integer typeId, Integer type, String image, String name, BigDecimal price, LocalDateTime startTime, LocalDateTime endTime, Integer status) {
        this.id = id;
        this.phone = phone;
        this.typeId = typeId;
        this.type = type;
        this.image = image;
        this.name = name;
        this.price = price;
        this.startTime = startTime;
        this.endTime = endTime;
        this.status = status;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Integer getTypeId() {
        return typeId;
    }

    public void setTypeId(Integer typeId) {
        this.typeId = typeId;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public LocalDateTime getStartTime() {
        return startTime;
    }

    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }

    public LocalDateTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Order order = (Order) o;
        return Objects.equals(id, order.id) &&
                Objects.equals(phone, order.phone) &&
                Objects.equals(typeId, order.typeId) &&
                Objects.equals(type, order.type) &&
                Objects.equals(image, order.image) &&
                Objects.equals(name, order.name) &&
                Objects.equals(price, order.price) &&
                Objects.equals(startTime, order.startTime) &&
                Objects.equals(endTime, order.endTime) &&
                Objects.equals(status, order.status);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, phone, typeId, type, image, name, price, startTime, endTime, status);
    }

    @Override
    public String toString() {
        return "Order{" +
                "id=" + id +
                ", phone='" + phone + '\'' +
                ", typeId=" + typeId +
                ", type=" + type +
                ", image='" + image + '\'' +
                ", name='" + name + '\'' +
                ", price=" + price +
                ", startTime=" + startTime +
                ", endTime=" + endTime +
                ", status=" + status +
                ", createdUser='" + createdUser + '\'' +
                ", createdTime=" + createdTime +
                ", modifiedUser='" + modifiedUser + '\'' +
                ", modifiedTime=" + modifiedTime +
                '}';
    }
}
